/**
 * Created by win8 on 2016-07-20.
 */
;
(function ($) {
    var tabspanel = function (element) {
        this.el = $(element);
        this.init();
        this.initEvent();
    };

    tabspanel.prototype = {
        init: function () {
            var num = this.el.find('.item').length;
            this.el.find('.item').css('width', 100 / num + "%");
        },
        initEvent: function () {
            this.el.on('click', '.item', function () {
                var id = $(this).attr('data-href');
                $('.tab-panel').css('visibility','hidden');
                $(id).css("visibility","visible");
                $(this).siblings().removeClass('active');
                $(this).addClass('active');
            })
        }
    };

    $.fn.tabs = function (options) {
        return new tabspanel(this, options);
    }
})(Zepto);